import request from '@/utils/request'

// 任务列表
export function getTask(query) {
    return request({
        url: '/surveyTask/page',
        method: 'get',
        params: query
    })
}

// 查看任务
export function detailTask(query) {
    return request({
      url: '/surveyTask/findById',
      method: 'get',
      params: query
    })
  }

  // 获取子任务
export function getSubTask(query) {
    return request({
      url: '/surveyTask/getSubTask',
      method: 'get',
      params: query
    })
  }

// 新增任务
export function addTask(query) {
    return request({
        url: '/surveyTask/save',
        method: 'post',
        data: query
    })
}

// 新增子任务
export function addSubTask(query) {
    return request({
        url: '/surveyTask/saveSubTask',
        method: 'post',
        data: query
    })
}

// 删除小组
export function delTask(ids) {
    return request({
        url: `/surveyTask/delete/` + ids,
        method: 'post',
    })
}

// 修改任务
export function updateTask(query) {
    return request({
        url: '/surveyTask/update',
        method: 'post',
        data: query
    })
}

// 修改子任务
export function updateSubTask(query) {
    return request({
      url: '/surveyTask/update',
      method: 'post',
      data: query
    })
  }

// 分配小组
export function groupFp(query) {
    return request({
        url: '/surveyTask/assignGroup',
        method: 'post',
        data: query
    })
}

// 获取父编码
export function getTaskBian(query) {
    return request({
      url: '/surveyTask/taskCode',
      method: 'get',
      params:query
    })
}

// 获取子编码
export function getSubTaskBian(query) {
    return request({
      url: '/surveyTask/subTaskCode',
      method: 'get',
      params:query
    })
  }
// 结束任务 
export function completeTask(ids) {
    return request({
        url: `/surveyTask/complete/` + ids,
        method: 'post',
    })
}

// 新增调研点
export function addSurvey(query) {
  return request({
      url: '/sampling/insertSurvey',
      method: 'post',
      data: query
  })
}

//地图获取行政区划树列表
export function getAreaTree() {
    return request({
        url: '/fxfz/sArea/getAreaTree',
        method: 'get'
    })
}
// 轨迹成员获取
export function getTrackPersonnel(query) {
  return request({
      url: '/surveyTask/getActionTrackPersonnel',
      method: 'get',
      params: query
  })
}

// 查询轨迹
export function searchTrack(query) {
  return request({
      url: '/actionTrack/getActionTracks',
      method: 'get',
      params: query
  })
}

//地图获取行政区划经纬度列表
export function getDistrictBoundary(code) {
    return request({
        url: '/boundary/getBoundaryEntityByCode?code='+code,
        method: 'get'
    })
}

//地图获取全部任务信息列表
export function getAllTaskList() {
    return request({
        url: '/surveyTask/getParentTask',
        method: 'get'
    })
}